package com.fjw.wechat_tool;

import android.annotation.SuppressLint;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

public class VoiceListAdapter extends ArrayAdapter<String> {
    private Context context;

    public VoiceListAdapter(Context context, List<String> objects) {
//        super(context, R.layout.voice_list_item, objects);
        super(context, android.R.layout.simple_list_item_1, objects);
        this.context = context;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View customView = inflater.inflate(R.layout.voice_list_item, parent, false);
        TextView textView = customView.findViewById(R.id.text);
        textView.setText(getItem(position));
        return customView;
    }
}